﻿using System.IO;

namespace Zijian666
{
    /// <summary>
    /// 运行时配置文件操作
    /// </summary>
    internal static class Runtimeconfig
    {
        private const string _content = @"{
  ""runtimeOptions"": {
    ""tfm"": ""net5.0"",
    ""framework"": {
      ""name"": ""Microsoft.NETCore.App"",
      ""version"": ""5.0.0""
    }
  }
}";
        /// <summary>
        /// 将运行时配置 runtimeconfig.json 写入硬盘
        /// </summary>
        public static void WriteToDisk()
        {

            var assembly = typeof(Ccli).Assembly;
            var dir = Path.GetDirectoryName(assembly.Location)!;
            var fileName = Path.Combine(dir, "Zijian666.Ccli.runtimeconfig.json");
            if (File.Exists(fileName))
            {
                return;
            }
            File.WriteAllText(fileName, _content);
        }
    }
}
